import { createRouter, createWebHashHistory } from 'vue-router'
// import HomeView from '../views/HomeView.vue'
// import DashBoard from '@/views/dashBoard.vue'
// import HomePage from '@/views/dangerBoard.vue'
import DashBoard from '../views/dashBoard.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: DashBoard
  },
  // {
  //   path: '/',
  //   redirect: '/dashBoard' // 重定向到仪表盘
  // },
  {
    path: '/dangerBoard',
    name: 'dangerBoard',
    component: () => import('../views/dangerBoard.vue')
  },
  {
    path: '/scanBoard',
    name: 'scanBoard',
    component: () => import('../views/scanBoard.vue')
  },
  {
    path: '/dashBoard',
    name: 'dashBoard',
    component: () => import('../views/dashBoard.vue'),
  },
  {
    path: '/aiChating',
    name: 'aiChating',
    component: () => import('../views/aiChating.vue')
  },
  {
    path: '/rootCauseAnalysis',
    name: 'rootCauseAnalysis',
    component: () => import('../views/rootCauseAnalysis.vue')
  },
  {
    path: '/systemLogin',
    name: 'systemLogin',
    component: () => import('../views/systemLogin.vue')
  },
  {
    path: '/shellChating',
    name: 'shellChating',
    component: () => import('../views/shellChating.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})
router.beforeEach((to, from, next) => {
  console.log('导航到:', to.path);
  next(); // 确保每次调用 next()
});

export default router
